package component;

import Main.Main;
import util.ImageUtils;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;

/**
 * @author zhongwen
 * @description 底部工具栏
 * @date 2021-12-09 22:21
 */
public class BottomBar extends JToolBar {
    private final VerticalSplitPane vsp;

    private static final Action rowAndColumnAction = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
        }
    };
    public static JButton rowAndColumnButton = new JButton(rowAndColumnAction);

    private final Action runAction = new AbstractAction("运行",
            new ImageIcon(ImageUtils.getImage("run.png", Main.configurationBean.getImageWidthAndHeight(),Main.configurationBean.getImageWidthAndHeight()))) {
        @Override
        public void actionPerformed(ActionEvent e) {
           vsp.removeOrAddDownPanel();
        }
    };

    private static final Action encodeAction = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {

        }
    };
    public static JButton encodeButton = new JButton(encodeAction);

    public BottomBar(VerticalSplitPane vsp){
        this.vsp = vsp;
        init();
    }

    private void init(){
        JButton runButton = new JButton(runAction);
        this.add(runButton);
        this.addSeparator(new Dimension(1000,0));
        this.add(rowAndColumnButton);
        rowAndColumnButton.setText("0:0");
        this.addSeparator();
        encodeButton.setText("UTF-8");
        this.add(encodeButton);
        this.setOrientation(HORIZONTAL);
        this.setFloatable(false);
    }

}
